import request from '@/utils/request'
import {BaseApi} from "@/api/base";
import {reactive} from "vue";

class User_api extends BaseApi {
    base = '/api/v1/user'
    login = '/api/v1/login'
    logout = '/api/v1/logout'

    Login = async (data) => {
        return await request({
            url: this.login,
            method: 'post',
            data: data,
        })
    }

    Logout = async () => {
        return await request({
            url: this.logout,
            method: 'post',
            headers: {
                'Content-Type': 'application/json;charset=UTF-8'
            }
        })
    }

    Project = async (name) => {
        var data = reactive([])

        await request({
            url: this.base + "/project_list/" + name,
            method: 'get',
        }).then((response) => {
            data = response.data
        })
        return data
    }
}


export const user = new User_api()